From: Jean-Yves Migeon Date: Fri, 29 Nov 2013 10:39:23 +0000 (+0100) Subject: Fix ptr calculation when converting from a VA X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~5833 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=cb08944a482a5e80a3ff1113f0735761cc4c6cb8;p=xen.git Fix ptr calculation when converting from a VA The ptr calculation shall take the offset into the page into account when ptr is valid. Reported regression on NetBSD's port-xen with last known working libxen being rev 2.9. This corrupts the kernel symbol table when the table is not loaded on a page boundary. Issue was tracked down by FastIce and Jeff Rizzo. See also http://mail-index.netbsd.org/port-xen/2013/10/16/msg008088.html Signed-off-by: Jean-Yves Migeon Reviewed-by: Jan Beulich Acked-by: Ian Campbell --- diff --git a/tools/libxc/xc_dom.h b/tools/libxc/xc_dom.h index a183e62ee4..7099ceebdd 100644 --- a/tools/libxc/xc_dom.h +++ b/tools/libxc/xc_dom.h @@ -342,7 +342,7 @@ static inline void *xc_dom_vaddr_to_ptr(struct xc_dom_image *dom, if ( ptr == NULL ) return ptr; *safe_region_out = (safe_region_count << XC_DOM_PAGE_SHIFT(dom)) - offset; - return ptr; + return ptr + offset; } static inline xen_pfn_t xc_dom_p2m_host(struct xc_dom_image *dom, xen_pfn_t pfn)